// cmw500.cpp: implementation of the cmw500 class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "signal_generator.h"
#include "cmw500.h"
//#include "visa.h"
#include "segment.h"


#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

cmw500::cmw500()
{
    /*
	ViSession defaultRM, vi;
	// Initialize device&Open session
	viOpenDefaultRM (&defaultRM);
	viOpen (defaultRM, "GPIB0::14::INSTR", VI_NULL,VI_NULL, &vi);

    viPrintf (vi, "*OPC?\n");	
    */
}

cmw500::~cmw500()
{
}

int cmw500::build_signal_array(CPtrArray* signal_array)
{
	//CPtrArray signal_array;  //store signal segments array
    int size=signal_array->GetSize();  
    
    for(int i=0;i<size;i++)  
    {
        segment* peek = (segment*)((*signal_array)[i]);

        // inject into intrument
        printf("%d %f %f %f %d", 
            peek->repeats,
            peek->frequency_MHz,
            peek->power_dbm,
            peek->dwell_ms,
            peek->gain,
            peek->switcher,
            i); 
    }

	//CPtrArray signal_array;  //store signal segments array
    size=signal_array->GetSize();  
    
    for( i=0;i<size;i++)  
    {
        delete (*signal_array)[i];
    }

    signal_array->RemoveAll();  

    return 0;
}

int cmw500::set_address(CString address)
{
	return 0;
}
